import { createRouter, createWebHistory } from 'vue-router'

const routes = [
  {
    path: '/',
    redirect: '/home'
  },
  {
    path: '/home',
    name: 'home',
    component: () => import('@/views/Home.vue'),
    meta: {
      index: 1
    }
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('@/views/Login.vue'),
    meta: {
      index: 1
    }
  },
  {
    path: '/cart',
    name: 'cart',
    component: () => import('@/views/Cart.vue'),
    meta: {
      index: 1
    }
  },
  {
    path: '/mine',
    name: 'mine',
    component: () => import('@/views/Mine.vue'),
    meta: {
      index: 1
    }
  },
  {
    path: '/catogory',
    name: 'catogory',
    component: () => import('@/views/Catogory.vue'),
    meta: {
      index: 1
    }
  },
  {
    path: '/search',
    name: 'search',
    component: () => import('@/views/Search.vue'),
    meta: {
      index: 2
    }
  },
  {
    path: '/detail',
    name: 'detail',
    component: () => import('@/views/Detail.vue'),
    meta: {
      index: 2
    }
  },
  {
    path: '/order',
    name: 'order',
    component: () => import('@/views/Order.vue'),
    meta: {
      index: 2
    }
  },
  {
    path: '/address',
    name: 'address',
    component: () => import('@/views/Address.vue'),
    meta: {
      index: 3
    }
  },
  {
    path: '/addressEdit',
    name: 'addressEdit',
    component: () => import('@/views/AddressEdit.vue'),
    meta: {
      index: 4
    }
  },
  {
    path: '/myOrder',
    name: 'myOrder',
    component: () => import('@/views/MyOrder.vue'),
    meta: {
      index: 2
    }
  },
  {
    path: '/order-detail',
    name: 'order-detail',
    component: () => import('@/views/OrderDetail.vue'),
    meta: {
      index: 3
    }
  },
  {
    path: '/userAccount',
    name: 'userAccount',
    component: () => import('@/views/userAccount.vue'),
    meta: {
      index: 2
    }
  },
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
